pull: Show Estimating if we're scanning too
authorColin Walters <walters@verbum.org>
Thu, 19 Jan 2017 10:49:23 +0000 (05:49 -0500)
committerAtomic Bot <atomic-devel@projectatomic.io>
Tue, 7 Feb 2017 19:59:40 +0000 (19:59 +0000)
The libcurl backend does all the work in the main thread/loop, which
seems to starve the idle scanning worker more.  With the libcurl
backend, we're a lot more likely to have at least one outstanding
metadata request.

But it can more easily transiently happen with libcurl that all of our current
fetches are content. To be accurate here, just show Estimating if we're scanning
too.

Closes: #654
Approved by: jlebon

src/libostree/ostree-fetcher.c
src/libostree/ostree-repo-pull.c
src/libostree/ostree-repo.c

index bc6c14c9ec5db5dddff8f44afb8a5170046eb883..bb98023dc65c24ef1670575884d0ea1916a63651 100644 (file)
@@ -552,11 +552,11 @@ ostree_fetcher_session_thread (gpointer data)
   /* XXX: Now that we have mirrorlist support, we could make this even smarter
    * by spreading requests across mirrors. */
   g_object_get (closure->session, "max-conns-per-host", &max_conns, NULL);
-  if (max_conns < 8)
+  if (max_conns < _OSTREE_MAX_OUTSTANDING_FETCHER_REQUESTS)
     {
       /* We download a lot of small objects in ostree, so this
        * helps a lot.  Also matches what most modern browsers do. */
-      max_conns = 8;
+      max_conns = _OSTREE_MAX_OUTSTANDING_FETCHER_REQUESTS;
       g_object_set (closure->session,
                     "max-conns-per-host",
                     max_conns, NULL);
index 21f3007e3111c9da95d5d8ca4e9060dc5fd87851..79da78095cc12b172862733a37399bad070a7732 100644 (file)
@@ -210,6 +210,7 @@ update_progress (gpointer user_data)
   ostree_async_progress_set_uint (pull_data->progress, "outstanding-writes", outstanding_writes);
   ostree_async_progress_set_uint (pull_data->progress, "fetched", fetched);
   ostree_async_progress_set_uint (pull_data->progress, "requested", requested);
+  ostree_async_progress_set_uint (pull_data->progress, "scanning", g_queue_is_empty (&pull_data->scan_object_queue) ? 0 : 1);
   ostree_async_progress_set_uint (pull_data->progress, "scanned-metadata", n_scanned_metadata);
   ostree_async_progress_set_uint64 (pull_data->progress, "bytes-transferred", bytes_transferred);
   ostree_async_progress_set_uint64 (pull_data->progress, "start-time", start_time);
index 4ac39d11043cd9bceb1f50d551ba2b7164438278..47e95ae4121851943eaab21d0466e37324a28a3e 100644 (file)
@@ -3876,6 +3876,7 @@ ostree_repo_pull_default_console_progress_changed (OstreeAsyncProgress *progress
 {
   GString *buf;
   g_autofree char *status = NULL;
+  gboolean scanning;
   guint outstanding_fetches;
   guint outstanding_metadata_fetches;
   guint outstanding_writes;
@@ -3889,6 +3890,7 @@ ostree_repo_pull_default_console_progress_changed (OstreeAsyncProgress *progress
   outstanding_fetches = ostree_async_progress_get_uint (progress, "outstanding-fetches");
   outstanding_metadata_fetches = ostree_async_progress_get_uint (progress, "outstanding-metadata-fetches");
   outstanding_writes = ostree_async_progress_get_uint (progress, "outstanding-writes");
+  scanning = ostree_async_progress_get_uint (progress, "scanning") == 1;
   n_scanned_metadata = ostree_async_progress_get_uint (progress, "scanned-metadata");
   fetched_delta_parts = ostree_async_progress_get_uint (progress, "fetched-delta-parts");
   total_delta_parts = ostree_async_progress_get_uint (progress, "total-delta-parts");
@@ -3937,7 +3939,7 @@ ostree_repo_pull_default_console_progress_changed (OstreeAsyncProgress *progress
                                   formatted_bytes_sec, formatted_bytes_transferred,
                                   formatted_total, formatted_est_time_remaining);
         }
-      else if (outstanding_metadata_fetches)
+      else if (scanning || outstanding_metadata_fetches)
         {
           g_string_append_printf (buf, "Receiving metadata objects: %u/(estimating) %s/s %s",
                                   metadata_fetched, formatted_bytes_sec, formatted_bytes_transferred);